package com.example.safeassistan.my.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.my.model.HistoryTaskCheckLogModel;
import com.example.safeassistan.risk.model.RiskDetailCheckLogModel;

import java.util.List;

public class HistoryTaskCheckLogAdapter extends BaseQuickAdapter<HistoryTaskCheckLogModel.ResultDTO.RecordsDTO,BaseViewHolder> {
    public HistoryTaskCheckLogAdapter(@Nullable List<HistoryTaskCheckLogModel.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_historytaskcheckrecord, data);
    }

 @Override
    protected void convert(BaseViewHolder helper, HistoryTaskCheckLogModel.ResultDTO.RecordsDTO item) {
     TextView tvCheckResult=helper.getView(R.id.tvCheckResult);
        helper.setText(R.id.tvCreateTime,item.getCreateTime());
        helper.setText(R.id.tvCheckTitle,item.getRiskPointName());
        helper.setText(R.id.tvCheckPerson,item.getRealname());
        helper.setText(R.id.tvCheckAddress,"检查地址："+item.getCheckAddress());
        helper.setText(R.id.tvChecktableName,item.getTableName());
        helper.setText(R.id.tvDepartName,"【"+item.getDepartName()+"】");
        switch (item.getTableResult()){
            case 0:
                helper.setText(R.id.tvCheckResult,"未涉及");
                tvCheckResult.setTextColor(mContext.getColor(R.color.blue_3B5BEA));
                tvCheckResult.setBackgroundResource(R.drawable.stoke_blue_bg);
                break;
            case 1:
                helper.setText(R.id.tvCheckResult,"已通过");
                tvCheckResult.setTextColor(mContext.getColor(R.color.green));
                tvCheckResult.setBackgroundResource(R.drawable.stoke_green_bg);
                break;
            case 2:
                helper.setText(R.id.tvCheckResult,"未通过");
                tvCheckResult.setTextColor(mContext.getColor(R.color.red));
                tvCheckResult.setBackgroundResource(R.drawable.stoke_red_bg);
                break;
            case 3:
                helper.setText(R.id.tvCheckResult,"存在隐患");
                tvCheckResult.setTextColor(mContext.getColor(R.color.orange));
                tvCheckResult.setBackgroundResource(R.drawable.stoke_orange_bg);
                break;

        }

 }
}